package com.wmjsoft.cglib

import net.sf.cglib.proxy.Enhancer
import net.sf.cglib.proxy.FixedValue
import net.sf.cglib.proxy.InvocationHandler
import org.junit.Assert
import java.lang.reflect.Method

fun main () {
    val enhancer = Enhancer()
    enhancer.setSuperclass(Test::class.java)
    enhancer.setCallback(object : FixedValue {
        override fun loadObject(): Any? {
            println("我说你可以的")
            return null
        }

    })

    val t:Test = enhancer.create() as Test
    t.say()

//    Assert.assertEquals("hello cglib", t.say());
}

